//
//  LssVisitorViewController.swift
//  freeChatting
//
//  Created by mac on 16/4/17.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class LssVisitorViewController: UITableViewController {
    //登录判断参数
    var isLogin: Bool = LssAppAccountTools.sharedAccountTools.isLogin
    var visitorView: LssVisitorView?
    override func loadView() {
        if isLogin == true{
        super.loadView()
        }else{
        loadVistorView()
        }
    }
    func loadVistorView(){
        visitorView = LssVisitorView()
        visitorView?.VVDelegate = self
        self.view = visitorView
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        
        navigationItem.leftBarButtonItem = UIBarButtonItem.init(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginAction")
        navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "loginAction")
    }
    //Mark:实现注册和登录
    @objc private func loginAction(){
        //创建要跳转的控制器
        let OAuthController = LssOAuthViewController()
        presentViewController(UINavigationController(rootViewController: OAuthController), animated: true, completion: nil)
    }
}
extension LssVisitorViewController: LssVisitorViewDelegate{
    func loginClickAction(){
        loginAction()
    }
}
